

data temp;
set sas_lib.rent_data_final;
run;


proc freq data=temp;
tables msa_name3;
run;


data final;
total_leases=1;
run;


%let msa1='Atlanta';
%let msa2='Boston';
%let msa3='Cincinnati';
%let msa4='Dallas';
%let msa5='Denver';
%let msa6='Detroit';
%let msa7='Houston';
%let msa8='Kansas City';
%let msa9='Minneapolis';
%let msa10='New York';
%let msa11='Phoenix';
%let msa12='Portland';
%let msa13='San Diego';
%let msa14='San Francisco';
%let msa15='Seattle';
%let msa16='Tampa';
%let msa17='Washington';

%let msa18='Los Angeles';
%let msa19='Miami';



%macro sum1;

%do i=18 %to  19;

data temp1;
set temp;
if msa_name3=&&msa&i;
run;

proc sql;

create table leases_&i as
select unit_id, count(*) as total_leases from temp1
group by unit_id;

create table types_&i as
select distinct total_leases, count(*) as total_types_&i from leases_&i
group by total_leases;


quit;


data final;
merge final types_&i;
by total_leases;
run;


%end;

%mend;

%sum1;



